﻿using System;
using System.Data;
//using System.Data.OleDb;
using System.Data.SqlClient;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

/// <summary>

/// </summary>
public class Class1
{
    
    public Class1()
    {
        
    }
    

    public static string connstring =System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; 
    public static DataSet GDS(string sql)
    {
       
        SqlDataAdapter dap = new SqlDataAdapter(sql, connstring);
        DataSet ds = new DataSet();
        dap.Fill(ds);
        return ds;
    }
    public static void Dsql(string sql)
    {
       
        SqlConnection conn = new SqlConnection();
        conn.ConnectionString = connstring;
        conn.Open();
       
        SqlCommand cmd = new SqlCommand(sql, conn);
        cmd.ExecuteNonQuery();
        conn.Close();
    }
    public int hsgexucute(string sql)
    {
        


        SqlConnection conn = new SqlConnection();
        conn.ConnectionString = connstring;
        SqlCommand myCommand = new SqlCommand(sql, conn);

        SqlCommand cmd = new SqlCommand(sql, conn);


        try
        {
            conn.Open();
            myCommand.ExecuteNonQuery();
            return 1;
        }
        catch
        {
          
            return 0;

        }
        finally
        {
            conn.Close();
        }
    }

    public DataSet hsggetdata(string sql)
    {
         

        SqlConnection conn = new SqlConnection();
        conn.ConnectionString = connstring;
        SqlCommand myCommand = new SqlCommand(sql, conn);

        SqlCommand cmd = new SqlCommand(sql, conn);

        try
        {
            

            SqlDataAdapter da = new SqlDataAdapter(myCommand);
            DataSet ds = new DataSet();
            da.Fill(ds);

            return ds;
        }
        catch
        {
            
            return null;

        }
        finally
        {
            conn.Close();
        }
    }
}
